﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using FluentNHibernate.Mapping;
using YunBox2.Contracts;
using YunBox2.Contracts.Core;

namespace YunBox2.DAL.Maps
{
	public class PermissionMap:ClassMap<Permission>
	{
		public PermissionMap()
		{
			Id(x => x.Id).Column("Id").Default("(newid())");
			Map(x => x.OwnerID).Column("OwnerID").Not.Nullable();
		    Map(x => x.ModuleID).Column("ModuleID").Not.Nullable().Index("IDX_IDX_Permission_ModuleID");
            Map(x => x.Visible).Not.Nullable().CustomSqlType("bit");
            Map(x => x.Edit).CustomSqlType("bit");
            Map(x => x.Remove).CustomSqlType("bit");
            Map(x => x.Print).CustomSqlType("bit").Column("PrintTo");
            Map(x => x.Audit).CustomSqlType("bit");
            Map(x => x.Approve).CustomSqlType("bit");
            Map(x => x.Invalid).CustomSqlType("bit");
			Map(x => x.Extensions).Column("Extensions").CustomSqlType("NVarChar(Max)").Default("'<permission/>'");
			Map(x => x.LastModifiedTime).Not.Nullable();
			References(x => x.LastModifiedUser).Column("LastModifiedUserID").Not.Nullable();
			Table("Permission");
		}
	}
}
